package bg.consulting.labo.rtp;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

import bg.consulting.labo.util.UtilSwing;
import bg.consulting.mixage.poubelleStreamming_3.AVTransmit3;

public class MainTest_4 {

	public static int port =42050;
	public static String ip = "192.168.1.10"; 
	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception{
		JFrame frame = new JFrame();
		Thread.sleep(2000);
		System.out.println("-----------------");		
		
		JButton burronEmission = new JButton("Emission");
		burronEmission.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				Test_SEND t =new Test_SEND();
			}
		});
		JButton burronReception = new JButton("Reception");
		burronReception.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				Test_RECEIVE t = new Test_RECEIVE();
				
			}
		});
		JPanel panel = new JPanel();
		panel.add(new JLabel("   Transmit 3"));
		panel.add(burronEmission);
		panel.add(burronReception);
		frame.add(panel);
		UtilSwing.initFrame(frame);
	}
	
	

}

class Test_SEND implements Runnable {
	
	Test_SEND() {
		Thread t = new Thread(this);
		t.start();
	}
	public void run() {
		try {
			String[] s ={};
			BgTransmitRTP.main(s);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

class Test_RECEIVE implements Runnable {
	
	public Test_RECEIVE() {
		Thread t = new Thread(this);
		t.start();
	}
	public void run() {
		try {
			String[] s ={MainTest_4.ip+"/"+MainTest_4.port};
			BgReceiveRTP.main(s);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
